import service from '@/utils/request'

export function getExamListService(params) {
  return service({
    url: '/exam/page/list',
    method: 'get',
    params
  })
}

export function addExamService(data) {
  return service({
    url: '/exam/add',
    method: 'post',
    data
  })
}

export function addExamQuestionService(data) {
  return service({
    url: '/exam/question/add',
    method: 'post',
    data
  })
}

export function getExamDetailService(examId) {
    return service({
        url: `/exam/${examId}`,
        method: 'get'
    })
}

export function publishExamService(examId) {
    return service({
        url: `/exam/publish`,
        method: 'put',
        params: {
            examId
        }
    })
}

export function cancelPublishExamService(examId) {
    return service({
        url: `/exam/cancelPublish`,
        method: 'put',
        params: {
            examId
        }
    })
}

export function  deleteExamService(examId) {
    return service({
        url: `/exam/${examId}`,
        method: 'delete',
    })
}

export function editExamService(data) {
    return service({
        url: '/exam/edit',
        method: 'put',
        data
    })
}

export function deleteExamQuestionService(examId,questionId) {
    return service({
        url: `/exam/question/delete`,
        method: 'delete',
        params: {
            examId,
            questionId
        }
    })
}